home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 007 / battutor.arc / SLASH.ASM < prev    next >
Assembly Source File  |  1986-05-05  |  5KB  |  131 lines

  1.                PAGE 60,132
  2. TITLE  SLASH.COM  VER.2.0  14-AUG-83  15:20
  3. comment *
  4.  
  5.                         SLASH.COM
  6.  
  7.  
  8.         VERSION 2.0     14-AUG-83
  9.  
  10.         Written by      Warren Craycroft
  11.                         6236 Oakdale Ave.
  12.                         Oakland, CA  94605
  13.  
  14.  
  15.         (C)  1983  by Warren Craycroft.  Permission is granted to copy and
  16.         distribute this program, including source code, provided that no
  17.         charge shall be made except for a reasonable charge for the media
  18.         and handling, and that this notice shall remain intact in all copies.
  19.  
  20.  
  21. *
  22. comment *
  23.         This program is a utility that can be used with DOS 2.0
  24.         to help format the system console display, especially
  25.         during execution of a batch file.  The program does this by
  26.         parsing the command line entered with SLASH.  The syntax
  27.         of the command line is shown below.  Brackets [] denote optional
  28.         fields of the command line (the brackets themselves should not
  29.         appear in the command line characters):
  30.  
  31.                 SLASH [ / [ cmd1 [ cmd2 ...]] / ] [ <string>
  32.  
  33.         cmdi are one-letter commands listed below.
  34.  
  35.         If the first slash is present, then all one-letter commands
  36.         recognized between first and second slash are executed in the
  37.         order inwhich they occure left to right.
  38.  
  39.         If slashes are not present, the string is displayed with leading
  40.         tabs and blanks removed.
  41.  
  42.         If slashes are present, all characters after the second slash are
  43.         displayed, including all leading tabs and blanks.
  44.  
  45.         A carriage return - line feed is sent to the display at the end of
  46.         a NON-null <string>.  If however the <string> is null, or if slashes
  47.         are absent and string is all blanks and tabs, then no CR LF is displayed
  48.                ( i.e. to skip a line, use SLASH/L and not SLASH )
  49.  
  50.  
  51.         The one-letter commands include:
  52.  
  53.                 L or l          skip one line
  54.  
  55.                 B or b          sound buzzer
  56.  
  57.                 D or d          print border across screen, double line
  58.  
  59.  
  60.  
  61.                 INCLUDE THESE FILES WHEN ASSEMBLING
  62.  
  63.                         PARSER.INC
  64.  
  65.                         Q_CMDS.INC
  66.  
  67.  
  68. *
  69. ;
  70. ;               constant equates
  71. ;
  72. BEL_CHAR        EQU     07              ;ascii BEL keycode
  73. CR              EQU     0DH             ;ascii carriage return
  74. LF              EQU     0AH             ;ascii line feed
  75. BLANK_CHAR      EQU     20H             ;ascii blank character
  76. ;
  77. ;       declare a relocatable segment.  Follow the .COM file requirements
  78. ;       of entry point at 100H and making all seg register references relative
  79. ;       to CS (no relocatable values MOV'ed into segment registers).
  80. ;
  81. ;
  82. COM_CODE      SEGMENT
  83. ;
  84.                 ORG     80H             ;PSP offset 80:  user's command line
  85. PSP_CMD_LINE    LABEL   BYTE            ;define a label for address refs
  86. ;
  87.                 ORG     100H            ;for COM file
  88. ;
  89. ;
  90.                 ASSUME  CS:COM_CODE,DS:COM_CODE    ;tell assembler value of CS
  91.                                                    ; and DS
  92. ;
  93. ;       parse command line in PSP for commands inside slashes
  94. ;
  95. ;       leave CX pointing to first character after leading delimiters if no
  96. ;       slashes, or first char after second slash
  97. ;
  98. START           PROC            FAR     ;FAR is meaningless; no RETS
  99. ;
  100. ;       address of PSP's command line into SI
  101. ;
  102.                 MOV     SI,OFFSET PSP_CMD_LINE
  103. ;
  104. INCLUDE         PARSER.INC              ;bring in parser include file
  105. ;
  106. ;       if the string is not null (CX not zero), then display the
  107. ;       string and append a CR LF onto the string
  108. ;       Use single character DOS function; DOS string display function
  109. ;       will not display "$".
  110. ;
  111.                 MOV     AH,2            ;DOS fn call, 1 char display
  112.                 OR      CL,CL           ;is byte count of string zero?
  113.                 JE      EXIT            ;no display if yes
  114. DISPLAY_LINE:   MOV     DL,[SI][BX]     ;next char into DL
  115.                 INT     21H             ;call DOS to display char
  116.                 INC     BX              ;point to next char
  117.                 LOOP    DISPLAY_LINE    ;and loop on char count
  118.                 CALL    SKIP            ;append CR LF onto end of string
  119.  
  120. ;
  121. ;       return to DOS
  122. ;
  123. EXIT:           INT     20H             ;return to DOS
  124. START           ENDP
  125. PAGE
  126. INCLUDE         Q_CMDS.INC              ;bring in slash command tables and code
  127. ;
  128. COM_CODE        ENDS
  129.                 END     START
  130. age string
  131.                 MOV     AH,9            ;DOS fun code to display string